// 模块化 
import { InjectionKey } from 'vue'
import { createStore, useStore as baseUseStore, Store } from 'vuex'

// 导入小仓库
// 前面 数据
// 后面 类型
// tab切换栏
import { tabState, TabState } from "./tabs/tabs"
// 登录
import { authState, AuthState } from './auth/auth'
// 权限菜单
import { menuState, MenuState } from './menu/menu'
// 按钮权限
import { buttonState, ButtonState } from './button/button'
export interface RootState {
  tabState: TabState,
  authState: AuthState,
  menuState: MenuState,
  buttonState: ButtonState
}
export const key: InjectionKey<Store<RootState>> = Symbol()

export const store: Store<RootState> = createStore({
  modules: {
    tabState,
    authState,
    menuState,
    buttonState
  }
})
export function useStore() {
  return baseUseStore(key)
}
